import { defineStore } from 'pinia';
import Q3D_I_State_Global from './Q3D_I_State_Global';
import Q3D_F_Persist from './Q3D_F_Persist';

// defineStore 调用后返回一个函数，调用该函数获得 Store 实体
export default defineStore({
    id: 'Q3D_Store_Global',
    // state: 返回对象的函数
    state: (): Q3D_I_State_Global => ({
        string_token: '',
        any_user_info: '',
        string_element_size: 'default',
        string_language: '',
    }),
    getters: {},
    actions: {
        Q3D_F_Token_Set(token: string) {
            this.string_token = token;
        },
        Q3D_F_UserInfo_Set(user_info: any) {
            this.any_user_info = user_info;
        },
        Q3D_F_Language_Set(language: string) {
            this.string_language = language;
        },
        setAssemblySizeSize(element_size: string) {
            this.string_element_size = element_size;
        },
    },
    persist: Q3D_F_Persist('Q3D_Store_Global')
});
